#ifndef __DAISY_VIEW_OGRE_GRAPHICS_MANAGER_IMPL_H__
#define __DAISY_VIEW_OGRE_GRAPHICS_MANAGER_IMPL_H__
#include "ViewOgreConfig.h"
#include <daisy\FrameworkBasePreDecl.h>
#include <daisy\WindowInterface.h>
namespace DAISY {
    
	typedef std::map<std::string,Ogre::SceneManager*> SceneMgrMap;
	typedef boost::scoped_ptr<Ogre::SceneManager> SceneMgrPtr;
	
class _DaisyViewOgrePrivate OgreGraphicsManagerImpl: public WindowListener
{
public:
	OgreGraphicsManagerImpl(void);
	~OgreGraphicsManagerImpl(void);
	Ogre::Camera * getCamera(void);
	Ogre::SceneManager * getSceneManager(void);
	Ogre::RenderWindow * getRenderWindow(void);
	void addSceneManager(const std::string & name,const std::string & type);
	Ogre::SceneManager * getSceneManager(const std::string & name);
	Ogre::Root* getRoot();
	bool update(TimeType interval);
	bool init(void);
	void shutdown(void);
private:


	virtual void onSizeChange(size_t width, size_t height);
	virtual void onClosed(void){_exit = true;}
	OgreWindowPtr createRenderWindowIn(void);
	OgreWindowPtr createRenderWindowOut(WeakWindowPtr win);
	void setupResources(void);
	void clearResources(void);

	void createSceneManager(void);
	void destroySceneManager(void);

	void createCamera(void);
	void destroyCamera(void);

	void createViewports(void);
	void destroyViewports(void);


	void loadResources(void);



	void createSimpleScene(void);
	void destroySimpleScene(void);


	boost::scoped_ptr<Ogre::Root> _root;
	OgreWindowPtr _window;
	Ogre::SceneManager * _sceneManager;
	Ogre::Camera * _camera;
	Ogre::Viewport* _viewport;
	SceneMgrMap _sceneMgrMap;
	//SceneMgrPtr _sceneManager;
	
private:
	bool _init;
	bool _exit;
	
	
};
}

#endif

